I keep getting the below warning in my log files:
3500 15:00:40 WARN Item threshold exceeded for web page. Items accessed: 2348. Threshold: 1000. Page URL: …
What could cause it, and how to fix it?
Item, memory and timing thresholds in Sitecore only provide accurate data in testing scenarios with a single visitor accessing the site. These threshold warnings can be useful when evaluating the performance of a specific page when accessed by a single user. In production environments, however, when many people are accessing the site, these warnings reflect the activity of many users and, as a result, do not provide useful information from a performance monitoring perspective. As a result, Sitecore recommends disabling these warning messages so that log files do not become unnecessarily cluttered.
This message appears in Sitecore logs due to the Sitecore architecture. Generally, such messages are very important in development and testing environment when tests are performed in single request mode. There is a single counter for measuring the number of accessed items. At the beginning of a request the value of the counter is stored and subtracted from the value of the same counter after finishing the item rendering. The result is the number of items accessed during the request. If two or more requests are handled simultaneously, accessing item attempts overlap and the number of accessed items may be incorrect. The same holds true for the memory and time threshold. However, when you are repeatedly confronted with such warnings for a particular page, this may indicate that you need to review its logic and perform a detailed investigation in the single request mode with special tools, such as Sitecore Debugger or smth. like dotTrace profiler.
There are two possible ways to disable threshold warnings in Sitecore logs for production environments.
<httpRequestEnd>
<processor type="Sitecore.Pipelines.HttpRequest.EndDiagnostics, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.HttpRequest.StopMeasurements, Sitecore.Kernel">
<TimingThreshold desc="Milliseconds">100000</TimingThreshold>
<ItemThreshold desc="Item count">100000</ItemThreshold>
<MemoryThreshold desc="KB">1000000</MemoryThreshold>
</processor>
</httpRequestEnd>
<root>
<priority value="ERROR" />
<appender-ref ref="LogFileAppender" />
</root>